﻿using System;
using System.Data;
using System.Data.SqlClient;


namespace PPI.Data
{
    public class DVendor_Contacts
    {
        #region Query
        public static DataSet SelectAllIdNameByVendor(int vendorID, string connectionKey)
        {
            SqlDataAdapter da = null;
            try
            {
                da = new SqlDataAdapter("up_Vendor_Contacts_SelectAllIdNameByVendor", DBHelper.GetConnection(connectionKey));
                da.SelectCommand.Parameters.Add(DBHelper.CreateIntParameter("@VendorID", ParameterDirection.Input, false, vendorID));
                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                DataSet ds = new DataSet();
                da.Fill(ds);
                return ds;
            }
            catch (Exception ex)
            {
                throw new Exception("Error executing up_Vendor_Contacts_SelectAllIdNameByVendor", ex);
            }
            finally
            {
                if (da != null) da.SelectCommand.Connection.Close();
            }
        }
        #endregion
    }
}
